<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>菜鸟教程(runoob.com)</title>
		<script>
			function displayDate(){
				document.getElementById("demo").innerHTML = Date()
			}
			var x;
			var d = new Date().getDay();
			console.log(d)
			switch(d){
				case 0:x="今天星期日";
				break;
				case 1:x="今天星期一";
				break;
				case 2:x="今天星期二";
				break;
				case 3:x="今天星期三";
				break;
				case 4:x="今天星期四";
				break;
				case 5:x="今天星期五";
				break;
				case 6:x="今天星期六";
				break;
			}
			if(d === 0 || d === 6){
				x = x + '期待周末'
			}else {
				x = x + '，上班吧'
			}
			function displayWeek() {
				document.getElementById("week").innerHTML = x
			}
		</script>
	</head>
	<body>
		<h1>1</h1>
		<p id="demo">日期</p>
		<button type="button" onClick="displayDate()">显示日期</button>
		<h2>2</h2>
		<p id="week">星期</p>
		<button onClick="displayWeek()">显示星期</button>
	</body>
</html>
